-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow to deploy lambda func locally (#96) #135
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closes #96 |
💰 Infracost estimate: monthly cost will not change This comment will be updated when the cost estimate changes. |
Plan Result
Change Result (Click me) # aws_s3_bucket.images will be updated in-place
~ resource "aws_s3_bucket" "images" {
id = "mtchoun-mouh-lambda-function-locally-djansang"
tags = {
"Name" = "images"
"environment" = "mtchoun-mouh-master"
"project" = "mtchoun-mouh"
}
# (10 unchanged attributes hidden)
- server_side_encryption_configuration {
- rule {
- bucket_key_enabled = false -> null
- apply_server_side_encryption_by_default {
- sse_algorithm = "AES256" -> null
}
}
}
# (1 unchanged block hidden)
}
# aws_s3_bucket.website will be updated in-place
~ resource "aws_s3_bucket" "website" {
id = "mtchoun-mouh-lambda-function-locally-mtchoun-mouh.mongulu.cm"
tags = {
"Name" = "Website"
"environment" = "mtchoun-mouh-master"
"project" = "mtchoun-mouh"
}
# (12 unchanged attributes hidden)
- server_side_encryption_configuration {
- rule {
- bucket_key_enabled = false -> null
- apply_server_side_encryption_by_default {
- sse_algorithm = "AES256" -> null
}
}
}
# (3 unchanged blocks hidden)
}
# local_file.index_page will be created
+ resource "local_file" "index_page" {
+ content = (sensitive value)
+ content_base64sha256 = (known after apply)
+ content_base64sha512 = (known after apply)
+ content_md5 = (known after apply)
+ content_sha1 = (known after apply)
+ content_sha256 = (known after apply)
+ content_sha512 = (known after apply)
+ directory_permission = "0777"
+ file_permission = "0777"
+ filename = "../html/index.html"
+ id = (known after apply)
}
Plan: 1 to add, 2 to change, 0 to destroy. |
✅ Apply Succeeded
Details (Click me)Running apply in the remote backend. Output will stream here. Pressing Ctrl-C
will cancel the remote apply if it's still pending. If the apply started it
will stop streaming the logs, but will not stop the apply running remotely.
Preparing the remote apply...
To view this run in a browser, visit:
https://app.terraform.io/app/tfc-mongulu-cm/mtchoun-mouh-lambda-function-locally/runs/run-hfbqoNmu3WL7kRsn
Waiting for the plan to start...
Terraform v1.5.3
on linux_amd64
Initializing plugins and modules...
data.archive_file.lambda_zip: Reading...
data.archive_file.lambda_zip: Read complete after 0s [id=cea0a0a287d457ac77c3f10324500079338bd492]
data.aws_caller_identity.current: Reading...
data.aws_iam_role.role: Reading...
aws_api_gateway_rest_api.api: Refreshing state... [id=n7e4almtxi]
aws_cloudwatch_event_rule.scheduler: Refreshing state... [id=mtchoun-mouh-lambda-function-locally-trigger_user_scan]
aws_dynamodb_table.Users: Refreshing state... [id=mtchoun-mouh-lambda-function-locally-Users]
aws_dynamodb_table.Register: Refreshing state... [id=mtchoun-mouh-lambda-function-locally-Register]
aws_dynamodb_table.Link_table: Refreshing state... [id=mtchoun-mouh-lambda-function-locally-Link_table]
aws_s3_bucket.website: Refreshing state... [id=mtchoun-mouh-lambda-function-locally-mtchoun-mouh.mongulu.cm]
aws_s3_bucket.images: Refreshing state... [id=mtchoun-mouh-lambda-function-locally-djansang]
data.aws_caller_identity.current: Read complete after 0s [id=053932140667]
data.aws_iam_role.role: Read complete after 0s [id=website-deployer]
aws_lambda_function.scan: Refreshing state... [id=mtchoun-mouh-lambda-function-locally-scan_user_consulcam]
aws_lambda_function.lambda: Refreshing state... [id=mtchoun-mouh-lambda-function-locally-user_registration_consulcam]
aws_api_gateway_resource.resource: Refreshing state... [id=dtiizw]
module.cors.aws_api_gateway_method._: Refreshing state... [id=agm-n7e4almtxi-dtiizw-OPTIONS]
aws_api_gateway_method.method: Refreshing state... [id=agm-n7e4almtxi-dtiizw-POST]
aws_api_gateway_method_response.method_response_200: Refreshing state... [id=agmr-n7e4almtxi-dtiizw-POST-200]
aws_lambda_permission.apigw_lambda: Refreshing state... [id=AllowExecutionFromAPIGateway]
aws_api_gateway_integration.integration: Refreshing state... [id=agi-n7e4almtxi-dtiizw-POST]
module.cors.aws_api_gateway_method_response._: Refreshing state... [id=agmr-n7e4almtxi-dtiizw-OPTIONS-200]
module.cors.aws_api_gateway_integration._: Refreshing state... [id=agi-n7e4almtxi-dtiizw-OPTIONS]
aws_cloudwatch_event_target.target: Refreshing state... [id=mtchoun-mouh-lambda-function-locally-trigger_user_scan-lambda]
aws_lambda_permission.allow_cloudwatch_to_call_check_foo: Refreshing state... [id=AllowExecutionFromCloudWatch]
module.cors.aws_api_gateway_integration_response._: Refreshing state... [id=agir-n7e4almtxi-dtiizw-OPTIONS-200]
aws_api_gateway_deployment.test: Refreshing state... [id=r66a9d]
local_file.index_page: Refreshing state... [id=8bad49d1925f9f35f7de4c6e207ae79fbb7cf57b]
aws_s3_bucket_public_access_block.website: Refreshing state... [id=mtchoun-mouh-lambda-function-locally-mtchoun-mouh.mongulu.cm]
aws_s3_bucket_object.example_file: Refreshing state... [id=index.html]
aws_s3_bucket_policy.website: Refreshing state... [id=mtchoun-mouh-lambda-function-locally-mtchoun-mouh.mongulu.cm]
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
~ update in-place
Terraform will perform the following actions:
# aws_s3_bucket.images will be updated in-place
~ resource "aws_s3_bucket" "images" {
id = "mtchoun-mouh-lambda-function-locally-djansang"
tags = {
"Name" = "images"
"environment" = "mtchoun-mouh-master"
"project" = "mtchoun-mouh"
}
# (10 unchanged attributes hidden)
- server_side_encryption_configuration {
- rule {
- bucket_key_enabled = false -> null
- apply_server_side_encryption_by_default {
- sse_algorithm = "AES256" -> null
}
}
}
# (1 unchanged block hidden)
}
# aws_s3_bucket.website will be updated in-place
~ resource "aws_s3_bucket" "website" {
id = "mtchoun-mouh-lambda-function-locally-mtchoun-mouh.mongulu.cm"
tags = {
"Name" = "Website"
"environment" = "mtchoun-mouh-master"
"project" = "mtchoun-mouh"
}
# (12 unchanged attributes hidden)
- server_side_encryption_configuration {
- rule {
- bucket_key_enabled = false -> null
- apply_server_side_encryption_by_default {
- sse_algorithm = "AES256" -> null
}
}
}
# (3 unchanged blocks hidden)
}
# local_file.index_page will be created
+ resource "local_file" "index_page" {
+ content = (sensitive value)
+ content_base64sha256 = (known after apply)
+ content_base64sha512 = (known after apply)
+ content_md5 = (known after apply)
+ content_sha1 = (known after apply)
+ content_sha256 = (known after apply)
+ content_sha512 = (known after apply)
+ directory_permission = "0777"
+ file_permission = "0777"
+ filename = "../html/index.html"
+ id = (known after apply)
}
Plan: 1 to add, 2 to change, 0 to destroy.
------------------------------------------------------------------------
Cost estimation:
Resources: 3 of 5 estimated
$1.74096/mo +$0.0
------------------------------------------------------------------------
aws_s3_bucket.website: Modifying... [id=mtchoun-mouh-lambda-function-locally-mtchoun-mouh.mongulu.cm]
local_file.index_page: Creating...
local_file.index_page: Creation complete after 0s [id=8bad49d1925f9f35f7de4c6e207ae79fbb7cf57b]
aws_s3_bucket.images: Modifications complete after 6s [id=mtchoun-mouh-lambda-function-locally-djansang]
aws_s3_bucket.website: Modifications complete after 7s [id=mtchoun-mouh-lambda-function-locally-mtchoun-mouh.mongulu.cm]
Apply complete! Resources: 1 added, 2 changed, 0 destroyed.
Outputs:
register_table = "mtchoun-mouh-lambda-function-locally-Register"
stage_url = "https://n7e4almtxi.execute-api.eu-central-1.amazonaws.com/mtchoun-mouh-lambda-function-locally-dev"
website_url = "http://mtchoun-mouh-lambda-function-locally-mtchoun-mouh.mongulu.cm.s3-website.eu-central-1.amazonaws.com"
|
Plan Result
Change Result (Click me) # aws_lambda_function.lambda will be updated in-place
~ resource "aws_lambda_function" "lambda" {
id = "user_registration_consulcam"
~ last_modified = "2023-07-26T14:25:09.000+0000" -> (known after apply)
~ source_code_hash = "RCxoKhMzArgl+P+yLI623hMQO/w3SSojAbtIgc/RCz4=" -> "tHJu2emgQ9kzNW7FPMmapRecDBkm5Mhe9ozq4quonUI="
tags = {
"environment" = "mtchoun-mouh-master"
"project" = "mtchoun-mouh"
}
# (17 unchanged attributes hidden)
# (2 unchanged blocks hidden)
}
# aws_lambda_function.scan will be updated in-place
~ resource "aws_lambda_function" "scan" {
id = "scan_user_consulcam"
~ last_modified = "2023-07-26T15:04:45.000+0000" -> (known after apply)
~ source_code_hash = "/Nqxj3M9bd+TffREN8ZIxlt/VHlJOwcFzM1cIliaJAY=" -> "tHJu2emgQ9kzNW7FPMmapRecDBkm5Mhe9ozq4quonUI="
tags = {
"environment" = "mtchoun-mouh-master"
"project" = "mtchoun-mouh"
}
# (17 unchanged attributes hidden)
# (2 unchanged blocks hidden)
}
# aws_s3_bucket.images will be updated in-place
~ resource "aws_s3_bucket" "images" {
id = "djansang"
tags = {
"Name" = "images"
"environment" = "mtchoun-mouh-master"
"project" = "mtchoun-mouh"
}
# (10 unchanged attributes hidden)
- server_side_encryption_configuration {
- rule {
- bucket_key_enabled = false -> null
- apply_server_side_encryption_by_default {
- sse_algorithm = "AES256" -> null
}
}
}
# (1 unchanged block hidden)
}
# aws_s3_bucket.website will be updated in-place
~ resource "aws_s3_bucket" "website" {
id = "mtchoun-mouh.mongulu.cm"
tags = {
"Name" = "Website"
"environment" = "mtchoun-mouh-master"
"project" = "mtchoun-mouh"
}
# (12 unchanged attributes hidden)
- server_side_encryption_configuration {
- rule {
- bucket_key_enabled = false -> null
- apply_server_side_encryption_by_default {
- sse_algorithm = "AES256" -> null
}
}
}
# (3 unchanged blocks hidden)
}
# local_file.index_page will be created
+ resource "local_file" "index_page" {
+ content = (sensitive value)
+ content_base64sha256 = (known after apply)
+ content_base64sha512 = (known after apply)
+ content_md5 = (known after apply)
+ content_sha1 = (known after apply)
+ content_sha256 = (known after apply)
+ content_sha512 = (known after apply)
+ directory_permission = "0777"
+ file_permission = "0777"
+ filename = "../html/index.html"
+ id = (known after apply)
}
Plan: 1 to add, 4 to change, 0 to destroy. |
✅ Apply Succeeded
Details (Click me)Running apply in the remote backend. Output will stream here. Pressing Ctrl-C
will cancel the remote apply if it's still pending. If the apply started it
will stop streaming the logs, but will not stop the apply running remotely.
Preparing the remote apply...
To view this run in a browser, visit:
https://app.terraform.io/app/tfc-mongulu-cm/mtchoun-mouh-master/runs/run-GznEmtybmNEYPEvb
Waiting for the plan to start...
Terraform v1.5.2
on linux_amd64
Initializing plugins and modules...
data.archive_file.lambda_zip: Reading...
data.archive_file.lambda_zip: Read complete after 0s [id=cea0a0a287d457ac77c3f10324500079338bd492]
aws_cloudwatch_event_rule.scheduler: Refreshing state... [id=trigger_user_scan]
aws_dynamodb_table.Link_table: Refreshing state... [id=Link_table]
data.aws_iam_role.role: Reading...
data.aws_caller_identity.current: Reading...
aws_dynamodb_table.Users: Refreshing state... [id=Users]
aws_api_gateway_rest_api.api: Refreshing state... [id=gozv19c3jf]
aws_dynamodb_table.Register: Refreshing state... [id=Register]
aws_s3_bucket.images: Refreshing state... [id=djansang]
aws_s3_bucket.website: Refreshing state... [id=mtchoun-mouh.mongulu.cm]
data.aws_caller_identity.current: Read complete after 0s [id=053932140667]
data.aws_iam_role.role: Read complete after 0s [id=website-deployer]
aws_lambda_function.lambda: Refreshing state... [id=user_registration_consulcam]
aws_lambda_function.scan: Refreshing state... [id=scan_user_consulcam]
aws_api_gateway_resource.resource: Refreshing state... [id=gtenoa]
aws_api_gateway_method.method: Refreshing state... [id=agm-gozv19c3jf-gtenoa-POST]
module.cors.aws_api_gateway_method._: Refreshing state... [id=agm-gozv19c3jf-gtenoa-OPTIONS]
aws_api_gateway_method_response.method_response_200: Refreshing state... [id=agmr-gozv19c3jf-gtenoa-POST-200]
module.cors.aws_api_gateway_method_response._: Refreshing state... [id=agmr-gozv19c3jf-gtenoa-OPTIONS-200]
module.cors.aws_api_gateway_integration._: Refreshing state... [id=agi-gozv19c3jf-gtenoa-OPTIONS]
aws_lambda_permission.allow_cloudwatch_to_call_check_foo: Refreshing state... [id=AllowExecutionFromCloudWatch]
aws_cloudwatch_event_target.target: Refreshing state... [id=trigger_user_scan-lambda]
aws_api_gateway_integration.integration: Refreshing state... [id=agi-gozv19c3jf-gtenoa-POST]
aws_lambda_permission.apigw_lambda: Refreshing state... [id=AllowExecutionFromAPIGateway]
module.cors.aws_api_gateway_integration_response._: Refreshing state... [id=agir-gozv19c3jf-gtenoa-OPTIONS-200]
aws_api_gateway_deployment.test: Refreshing state... [id=7suq19]
local_file.index_page: Refreshing state... [id=3df23f6ccd0c737240f079546f3bd4cefc59b440]
aws_s3_bucket_public_access_block.website: Refreshing state... [id=mtchoun-mouh.mongulu.cm]
aws_s3_bucket_object.example_file: Refreshing state... [id=index.html]
aws_s3_bucket_policy.website: Refreshing state... [id=mtchoun-mouh.mongulu.cm]
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
~ update in-place
Terraform will perform the following actions:
# aws_lambda_function.lambda will be updated in-place
~ resource "aws_lambda_function" "lambda" {
id = "user_registration_consulcam"
~ last_modified = "2023-07-26T14:25:09.000+0000" -> (known after apply)
~ source_code_hash = "RCxoKhMzArgl+P+yLI623hMQO/w3SSojAbtIgc/RCz4=" -> "tHJu2emgQ9kzNW7FPMmapRecDBkm5Mhe9ozq4quonUI="
tags = {
"environment" = "mtchoun-mouh-master"
"project" = "mtchoun-mouh"
}
# (17 unchanged attributes hidden)
# (2 unchanged blocks hidden)
}
# aws_lambda_function.scan will be updated in-place
~ resource "aws_lambda_function" "scan" {
id = "scan_user_consulcam"
~ last_modified = "2023-07-26T15:04:45.000+0000" -> (known after apply)
~ source_code_hash = "/Nqxj3M9bd+TffREN8ZIxlt/VHlJOwcFzM1cIliaJAY=" -> "tHJu2emgQ9kzNW7FPMmapRecDBkm5Mhe9ozq4quonUI="
tags = {
"environment" = "mtchoun-mouh-master"
"project" = "mtchoun-mouh"
}
# (17 unchanged attributes hidden)
# (2 unchanged blocks hidden)
}
# aws_s3_bucket.images will be updated in-place
~ resource "aws_s3_bucket" "images" {
id = "djansang"
tags = {
"Name" = "images"
"environment" = "mtchoun-mouh-master"
"project" = "mtchoun-mouh"
}
# (10 unchanged attributes hidden)
- server_side_encryption_configuration {
- rule {
- bucket_key_enabled = false -> null
- apply_server_side_encryption_by_default {
- sse_algorithm = "AES256" -> null
}
}
}
# (1 unchanged block hidden)
}
# aws_s3_bucket.website will be updated in-place
~ resource "aws_s3_bucket" "website" {
id = "mtchoun-mouh.mongulu.cm"
tags = {
"Name" = "Website"
"environment" = "mtchoun-mouh-master"
"project" = "mtchoun-mouh"
}
# (12 unchanged attributes hidden)
- server_side_encryption_configuration {
- rule {
- bucket_key_enabled = false -> null
- apply_server_side_encryption_by_default {
- sse_algorithm = "AES256" -> null
}
}
}
# (3 unchanged blocks hidden)
}
# local_file.index_page will be created
+ resource "local_file" "index_page" {
+ content = (sensitive value)
+ content_base64sha256 = (known after apply)
+ content_base64sha512 = (known after apply)
+ content_md5 = (known after apply)
+ content_sha1 = (known after apply)
+ content_sha256 = (known after apply)
+ content_sha512 = (known after apply)
+ directory_permission = "0777"
+ file_permission = "0777"
+ filename = "../html/index.html"
+ id = (known after apply)
}
Plan: 1 to add, 4 to change, 0 to destroy.
------------------------------------------------------------------------
Cost estimation:
Resources: 3 of 5 estimated
$1.74096/mo +$0.0
------------------------------------------------------------------------
aws_lambda_function.lambda: Modifying... [id=user_registration_consulcam]
aws_s3_bucket.images: Modifying... [id=djansang]
aws_s3_bucket.website: Modifying... [id=mtchoun-mouh.mongulu.cm]
local_file.index_page: Creating...
local_file.index_page: Creation complete after 0s [id=3df23f6ccd0c737240f079546f3bd4cefc59b440]
aws_lambda_function.scan: Modifications complete after 2s [id=scan_user_consulcam]
aws_lambda_function.lambda: Modifications complete after 5s [id=user_registration_consulcam]
aws_s3_bucket.images: Modifications complete after 6s [id=djansang]
aws_s3_bucket.website: Modifications complete after 6s [id=mtchoun-mouh.mongulu.cm]
Apply complete! Resources: 1 added, 4 changed, 0 destroyed.
Outputs:
register_table = "Register"
stage_url = "https://gozv19c3jf.execute-api.eu-central-1.amazonaws.com/dev"
website_url = "http://mtchoun-mouh.mongulu.cm.s3-website.eu-central-1.amazonaws.com"
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.